﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GenericLibrariesToolKit;

namespace Model
{
    /// <summary>
    /// 企业实体
    /// </summary>
    public class Enterprise
    {
        /*企业ID*/
        public string EnterpriseId { get; set; }
        /*企业名称*/
        public string EnterpriseName { get; set; }
        /*企业电话*/
        public string EnterprisePhone { get; set; }
        /*企业email*/
        public string EnterpriseEmail { get; set; }
        /*企业地址*/
        public string EnterpriseAddress { get; set; }
        /*企业邮编*/
        public string EnterprisePostalCode { get; set; }
        /*城市*/
        public string EnterpriseCity { get; set; }
        /*省份*/
        public string EnterpriseProvince { get; set; }
        /*介绍*/
        public string EnterpriseIntroduce { get; set; }
        /*类型*/
        public string EnterpriseType { get; set; }


        /// <summary>
        /// 应用程序启动时，实体管理器将会调用此方法进行初始化。
        /// </summary>
        public void Intialization()
        {
            //声明一个实体实体对象
            Entity entity = new Entity();

            //指定该实体对应数据库中的表名
            entity.TableName = "T_ENTERPRISE";
            //指定该实体的标识符
            entity.EntityId = "EnterpriseId";
            //指定主键生成策略
            entity.Generator = GenericLibrariesToolKit.Enumeration.PKGenerationStrategy.USER_INPUT;
            ///实体关系映射字典
            ///key:实体属性名称，value:对应的数据库中表的字段名
            Dictionary<string, string> dictionary = new Dictionary<string, string>();

            dictionary.Add("EnterpriseId", "ENTERPRISE_ID");
            dictionary.Add("EnterpriseName", "ENTERPRISE_NAME");
            dictionary.Add("EnterprisePhone", "ENTERPRISE_PHONE");
            dictionary.Add("EnterpriseEmail", "ENTERPRISE_EMAIL");
            dictionary.Add("EnterpriseAddress", "ENTERPRISE_ADDRESS");
            dictionary.Add("EnterprisePostalCode", "ENTERPRISE_POSTAL_CODE");
            dictionary.Add("EnterpriseCity", "ENTERPRISE_CITY");
            dictionary.Add("EnterpriseProvince", "ENTERPRISE_PROVINCE");
            dictionary.Add("EnterpriseIntroduce", "ENTERPRISE_INTRODUCE");
            dictionary.Add("EnterpriseType", "ENTERPRISE_TYPE");

            //赋值
            entity.ORMDictionary = dictionary;

            //将实体加入实体管理器，
            EntityManager.GetInsatnce().AddEntity("Model.Enterprise", entity);
        }
    }
}
